package com.yhb.channel.dao.flow;

import com.yhb.controller.admin.form.QueryExecutionFlowForm;
import com.yhb.controller.admin.vo.UnionFlowQueryVo;
import com.yhb.model.ChannelBoundRelationship;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ExecutionFlowMapper {
    int insert(
            @Param("executionFlow") ExecutionFlow executionFlow,
            @Param("dateString") String dateString
    );

    ExecutionFlow getExecutionFlowById(
            @Param("id") String id,
            @Param("dateString") String dateString
    );

    ExecutionFlow getExecutionFlowByRequestId(
            @Param("requestId") String requestId,
            @Param("dateString") String dateString
    );

    int updateExecutionFlow(
            @Param("executionFlow") ExecutionFlow executionFlow,
            @Param("dateString") String dateString
    );

    int updateExecutionFlowByRequestId(
            @Param("executionFlow") ExecutionFlow executionFlow,
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getFlowByUserIdAndDateString(
            @Param("userId") String userId,
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getSucceedFlowsOfUserAndDateString(
            @Param("userId") String userId,
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getSucceedPayFlowsOfUserAndDateString(
            @Param("userId") String userId,
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getSucceedPayFlowsAndDateString(
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getPendingRemitFlowsByChannelType(
            @Param("channelType") String channelType,
            @Param("dateString") String dateString
    );

    List<ExecutionFlow> getPendingFlowsByChannelType(
            @Param("channelType") String channelType,
            @Param("dateString") String dateString
    );

    Map<String, String> getTablesWithDate(
            @Param("dateString") String dateString
    );

//    int

//    String makeFlowSuccess(
//            @Param("id") String id,
//            @Param("dateString") String dateString
//    );
//
//    String makeFlowFail(
//            @Param("id") String id,
//            @Param("dateString") String dateString
//    );
    /**
     * execution flow union execution_flow_union_pay
     */
    List<UnionFlowQueryVo> getUnionFlowByQueryExecutionFlowForm(
            @Param("form") QueryExecutionFlowForm form,
            @Param("ef") int ef,
            @Param("efup") int efup
    );

    ChannelBoundRelationship getChannelUserIdAndCardTypeFromChannelBoundRelationShipByCardId(@Param("tableName") String tableName, @Param("cardId")String cardId);

    Integer  isTableExist(@Param("tableName") String tableName);
}
